package com.usian.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.usian.pojo.Emp;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface EmpMapper extends BaseMapper<Emp> {
    //查询
    Page<Emp> findPage(Page<Emp> page1,@Param("name") String name,@Param("code")Integer code,@Param("did")Integer did,@Param("id")Integer id);
    //登录
    @Select("SELECT e.*,p.code grade FROM emp e LEFT JOIN posts p ON e.pid=p.id WHERE e.name=#{name}")
    Emp login(Emp emp);
    //根据ID查询全部信息
    @Select("SELECT e.*,p.code grade FROM emp e LEFT JOIN posts p ON e.pid=p.id WHERE e.id=#{id}")
    Emp findById(Integer id);
    //根据职位查询人数
    @Select("select count(*) from emp where pid=#{pid}")
    Integer findByPid(Integer pid);
    //判重
    @Select("select count(*) from emp where name=#{name}")
    Integer findByName(String name);
}







